<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

// 运费模板界面
class CreateLogisticsTemplatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('logistics_templates', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('模板名称');
            $table->string('type')->comment('模板类型: 默认地区, 指定地区')->default();
            $table->text('address_ids')->nullable()->comment('指定区域id');
            $table->boolean('open_piece')->default(true)->comment('是否开启: 按照件数计算');
            $table->unsignedTinyInteger('first_piece')->nullable()->comment('首件(件)')->default(0);
            $table->decimal('first_piece_price')->nullable()->comment('首件运费(元)')->default(0);
            $table->unsignedTinyInteger('other_piece')->nullable()->comment('续件(件)')->default(0);
            $table->decimal('other_piece_price')->nullable()->comment('续件运费(元)')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('logistics_templates');
    }
}
